#!/usr/bin/python
#coding=utf-8

import rospy
from rosmsg.msg import route

def ros_init(name):
	rospy.init_node('python', anonymous=True)
	pub = rospy.Publisher(name, route, queue_size=1)

	return pub

def send_route(pub, lon, lat):
	msg = route()

	msg.success = True
	msg.lon = lon
	msg.lat = lat

	pub.publish(msg)


if __name__ == '__main__':
	lon = [112.57128497791,112.571389799756,112.571390913619,112.571283146001,112.571281314092,112.571392027482,112.571373937447,112.571279482185,112.571277650277,112.571304283846]
	
	lat =  [34.597160148821,34.5971393826252,34.5971252606207,34.5971466104054,34.5971330719898,34.5971111386161,34.597100821099,34.5971195335741,34.5971059951583,34.5971007188058]

	pub = ros_init('/route')

	while not rospy.is_shutdown():
		send_route(pub, lon, lat)
		rospy.Rate(1).sleep()
		send_route(pub, lon, lat)
		rospy.Rate(1).sleep()
		rospy.signal_shutdown('done!')
